﻿@model Adams.Public.DataTransfer.Web.Areas.Membership.Classifieds.Index.PageLoad
@{
    Layout = "~/Views/Shared/_MembershipLayout.cshtml";
}
@section Head{
    <link rel="stylesheet" type="text/css" href="/Areas/Membership/Content/Classifieds/index.css" />
}
<h1>My Classifieds</h1>
<a class="shortcut-button" href="/MyAdams/Classifieds/Create"><span>
    Post a New Classified</span></a>
@foreach (var posting in Model.Postings)
{
    var did = "p_" + posting.ID.ToString();
    <div id="@did" class="posting">
        <div class="align-right">
            <input class="button edit" type="button" value="Edit" pid="@posting.ID" />
            @if (Adams.Shared.DateHelper.DiffDays(DateTime.Now, posting.ExpiresOn) < 0)
            {
                <input class="bluebutton renew" type="button" value="Renew" pid="@posting.ID" />    
            }
            <input class="redbutton remove" type="button" value="Remove" pid="@posting.ID" />
        </div>
        @if (Adams.Shared.DateHelper.DiffDays(DateTime.Now, posting.ExpiresOn) < 0)
        {
            <text>Expired</text>
        }
        else
        {
            if (posting.Status == Adams.Shared.Entities.Classifieds.Status.PendingApproval)
            {
                <text>Waiting for Approval</text>
            }
            else if (posting.Status == Adams.Shared.Entities.Classifieds.Status.Approved)
            {
                <text>Approved</text>
            }
            else if (posting.Status == Adams.Shared.Entities.Classifieds.Status.Rejected)
            {
                <text>Rejected</text>
            }
            else if (posting.Status == Adams.Shared.Entities.Classifieds.Status.Expired)
            {
                <text>Expired</text>
            }
        }
        <br />Title: @posting.Title
        <br />Created On: @posting.CreatedOn.ToShortDateString()
        <br />Expires On: 
        <span class="exp">@posting.ExpiresOn.ToShortDateString()</span>
        <br />Price: @posting.Price
        <br />Location: @posting.Location
        <br />ReplyTo: @posting.ReplyTo
        <br />Description:
        <br />@posting.Description
    </div>
}
@section Scripts {
    <script src="/Areas/Membership/Scripts/Classifieds/index.js" type="text/javascript"></script>
}